package v1

import (
	"gin-vue-admin/global"
    "gin-vue-admin/model"
    "gin-vue-admin/model/request"
    "gin-vue-admin/model/response"
    "gin-vue-admin/service"
    "github.com/gin-gonic/gin"
    "go.uber.org/zap"
)

// @Tags SysCaipiaoNumbers
// @Summary 创建SysCaipiaoNumbers
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SysCaipiaoNumbers true "创建SysCaipiaoNumbers"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /sysCaipiaoNumbers/createSysCaipiaoNumbers [post]
func CreateSysCaipiaoNumbers(c *gin.Context) {
	var sysCaipiaoNumbers model.SysCaipiaoNumbers
	_ = c.ShouldBindJSON(&sysCaipiaoNumbers)
	if err := service.CreateSysCaipiaoNumbers(sysCaipiaoNumbers); err != nil {
        global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
		response.FailWithMessage("创建失败", c)
	} else {
		response.OkWithMessage("创建成功", c)
	}
}

// @Tags SysCaipiaoNumbers
// @Summary 删除SysCaipiaoNumbers
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SysCaipiaoNumbers true "删除SysCaipiaoNumbers"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /sysCaipiaoNumbers/deleteSysCaipiaoNumbers [delete]
func DeleteSysCaipiaoNumbers(c *gin.Context) {
	var sysCaipiaoNumbers model.SysCaipiaoNumbers
	_ = c.ShouldBindJSON(&sysCaipiaoNumbers)
	if err := service.DeleteSysCaipiaoNumbers(sysCaipiaoNumbers); err != nil {
        global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
		response.FailWithMessage("删除失败", c)
	} else {
		response.OkWithMessage("删除成功", c)
	}
}

// @Tags SysCaipiaoNumbers
// @Summary 批量删除SysCaipiaoNumbers
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除SysCaipiaoNumbers"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /sysCaipiaoNumbers/deleteSysCaipiaoNumbersByIds [delete]
func DeleteSysCaipiaoNumbersByIds(c *gin.Context) {
	var IDS request.IdsReq
    _ = c.ShouldBindJSON(&IDS)
	if err := service.DeleteSysCaipiaoNumbersByIds(IDS); err != nil {
        global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
		response.FailWithMessage("批量删除失败", c)
	} else {
		response.OkWithMessage("批量删除成功", c)
	}
}

// @Tags SysCaipiaoNumbers
// @Summary 更新SysCaipiaoNumbers
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SysCaipiaoNumbers true "更新SysCaipiaoNumbers"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /sysCaipiaoNumbers/updateSysCaipiaoNumbers [put]
func UpdateSysCaipiaoNumbers(c *gin.Context) {
	var sysCaipiaoNumbers model.SysCaipiaoNumbers
	_ = c.ShouldBindJSON(&sysCaipiaoNumbers)
	if err := service.UpdateSysCaipiaoNumbers(sysCaipiaoNumbers); err != nil {
        global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
		response.FailWithMessage("更新失败", c)
	} else {
		response.OkWithMessage("更新成功", c)
	}
}

// @Tags SysCaipiaoNumbers
// @Summary 用id查询SysCaipiaoNumbers
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SysCaipiaoNumbers true "用id查询SysCaipiaoNumbers"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /sysCaipiaoNumbers/findSysCaipiaoNumbers [get]
func FindSysCaipiaoNumbers(c *gin.Context) {
	var sysCaipiaoNumbers model.SysCaipiaoNumbers
	_ = c.ShouldBindQuery(&sysCaipiaoNumbers)
	if err, resysCaipiaoNumbers := service.GetSysCaipiaoNumbers(sysCaipiaoNumbers.ID); err != nil {
        global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
		response.FailWithMessage("查询失败", c)
	} else {
		response.OkWithData(gin.H{"resysCaipiaoNumbers": resysCaipiaoNumbers}, c)
	}
}

// @Tags SysCaipiaoNumbers
// @Summary 分页获取SysCaipiaoNumbers列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.SysCaipiaoNumbersSearch true "分页获取SysCaipiaoNumbers列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /sysCaipiaoNumbers/getSysCaipiaoNumbersList [get]
func GetSysCaipiaoNumbersList(c *gin.Context) {
	var pageInfo request.SysCaipiaoNumbersSearch
	_ = c.ShouldBindQuery(&pageInfo)
	if err, list, total := service.GetSysCaipiaoNumbersInfoList(pageInfo); err != nil {
	    global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
        response.FailWithMessage("获取失败", c)
    } else {
        response.OkWithDetailed(response.PageResult{
            List:     list,
            Total:    total,
            Page:     pageInfo.Page,
            PageSize: pageInfo.PageSize,
        }, "获取成功", c)
    }
}


// @Tags GetLengSysCaipiaoNumbers
// @Summary 获取热冷彩票数据的统计
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.SysCaipiaoNumbersSearch true "分页获取SysCaipiaoNumbers列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /sysCaipiaoNumbers/GetLengSysCaipiaoNumbers [get]
func GetLengSysCaipiaoNumbers(c *gin.Context) {
	var Info request.SysCaipiaoNumberslengreData
	_ = c.ShouldBindQuery(&Info)
	if err, list, total := service.GetSysCaipiaoNumberslengreInfo(Info); err != nil {
		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
		response.FailWithMessage("获取失败", c)
	} else {
		response.OkWithDetailed(response.PageResult{
			List:     list,
			Total:    total,
			Page:     1,
			PageSize: 0,
		}, "获取成功", c)
	}
}